# -*- coding: utf-8 -*-
import sys,  string
from PyQt4 import QtCore, QtGui
from Ui_Login import Ui_Form

try:
    _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
    def _fromUtf8(s):
        return s
try:
    from win32com.client import Dispatch
except AttributeError:
    print "win32com fail!"

class StartQt4(QtGui.QMainWindow):
        def __init__(self, parent=None):
                QtGui.QWidget.__init__(self, parent)
                self.ui = Ui_Form()
                self.ui.setupUi(self)
                self.QCConnection = Dispatch("TDApiOle80.TDConnection")
                self.filename = None
                
                QtCore.QObject.connect(self.ui.btnAuthenticate, QtCore.SIGNAL(_fromUtf8("clicked()")), self.ALMAuthenticate)

                #QtCore.QObject.connect(self.ui.pushButton, QtCore.SIGNAL(_fromUtf8("clicked()")), self.ui.listWidget.clear)
                #QtCore.QObject.connect(self.ui.listWidget,QtCore.SIGNAL(_fromUtf8("currentTextChanged(QString)")), self.ui.listWidget_2.addItem)
                #QtCore.QObject.connect(self.listWidget, QtCore.SIGNAL(_fromUtf8("currentTextChanged(QString)")), self.label.setText)
                #QtCore.QObject.connect(self.ui.button_save,QtCore.SIGNAL("clicked()"), self.file_save)
        def ALMAuthenticate(self):
#            self.QCConnection.InitConnectionEx(self.ui.lneALMurl.text())
#            self.QCConnection.login(self.ui.lneUsername.text(), self.ui.lnePassword.text())
#            for Domain in self.QCConnection.VisibleDomains:
#                self.ui.cmbDomain.additem(Domain)
            self.ui.cmbDomain.setView()


if __name__ == "__main__":
        app = QtGui.QApplication(sys.argv)
        myapp = StartQt4()
        myapp.show()
        sys.exit(app.exec_())

